<?php
if (!defined('IN_DISCUZ')){
	exit('Access Denied');
}

global $_G;

//////////////////////////////////////////////KIEM TRA DIEU KIEN GIAN HANG//////////////////////////////////////////
if (!$uData)
	showmessage('ban_chua_dang_ky_gian_hang', 'shop.php?mod=store&ac=register');

if (!$_G['uid']){
	showmessage('postperm_login_nopermission', NULL, array(), array(
			'login'=>1
	));
}

if ($uData['verificationed'] != 1)
	showmessage('you_not_complete_profile_to_post', 'shop.php?mod=store&ac=profile&do=update');
//////////////////////////////////////////////////////////////////////////////////////
$mySql = ' AND p.uid = ' . $_G['uid'];

$view = isset($_G['gp_view']) ? strval($_G['gp_view']) : 'list';
$page = isset($_G['gp_page']) ? intval($_G['gp_page']) : 0;
$sort = isset($_G['gp_sort']) ? strval($_G['gp_sort']) : 'last';

//////////////////////////////////////////////////////////////////////////////////////

$limit = 10;
$curpage = is_numeric($_G['gp_page']) ? intval($_G['gp_page']) : 1;
$start = ($curpage - 1) * $limit;
$count = 0;

$_G['gp_ajaxtarget'] = 'listproduct_display';

$vUrl = $xUrl = '';
$sUrl = 'shop.php?mod=store&ac=mylist';

if ($sort)
	$xUrl = '&amp;sort=' . $sort;
if ($page)
	$xUrl = '&amp;page=' . $page;
if ($view){
	$xUrl = '&amp;view=' . $view;
	$vUrl = $sUrl . $xUrl;
}

$url = $sUrl . $xUrl;

$result = productList(-1, $mySql, $sort, $start, $limit, $count, true, true);
$pages = multi($count, $limit, $curpage, $url, 0, 10, false, false, 0);

$have = count($result);
if ($have)
	$moreJS = 1;

unset($_G['gp_ajaxtarget']);